package com.lg.partition29;

import java.io.*;
import java.util.Arrays;

/**
 * @author `RKC`
 * @date 2022/3/26 20:46
 */
public class P2872BuildingRoadsS {

    private static final int N = 1010;
    private static int[] parent = new int[N];
    private static Point[] points = new Point[N];
    private static Edge[] edges = new Edge[N * N];
    private static int n, m, cnt = 0;

    private static final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    private static final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        String[] ss = reader.readLine().split(" ");
        n = Integer.parseInt(ss[0]);
        m = Integer.parseInt(ss[1]);
        for (int i = 1; i <= n; i++) {
            parent[i] = i;
            ss = reader.readLine().split(" ");
            int x = Integer.parseInt(ss[0]), y = Integer.parseInt(ss[1]);
            points[i] = new Point(i, x, y);
        }
        for (int i = 1; i <= n; i++) {
            for (int j = i + 1; j <= n; j++) {
                edges[cnt++] = new Edge(i, j, cal(i, j));
            }
        }
        for (int i = 1; i <= m; i++) {
            ss = reader.readLine().split(" ");
            int id1 = Integer.parseInt(ss[0]), id2 = Integer.parseInt(ss[1]);
            edges[cnt++] = new Edge(id1, id2, 0);
        }
        //kruskal
        double ans = 0;
        Arrays.sort(edges, 0, cnt);
        for (int i = 0; i < cnt; i++) {
            int id1 = edges[i].id1, id2 = edges[i].id2;
            int a = find(id1), b = find(id2);
            if (a != b) {
                parent[a] = b;
                ans += edges[i].dist;
            }
        }
        writer.write(String.format("%.2f\n", ans));
        writer.flush();
    }

    private static int find(int x) {
        if (x != parent[x]) parent[x] = find(parent[x]);
        return parent[x];
    }

    private static double cal(int id1, int id2) {
        return Math.sqrt((double) (points[id1].x - points[id2].x) * (points[id1].x - points[id2].x) + (double) (points[id1].y - points[id2].y) * (points[id1].y - points[id2].y));
    }

    private static class Edge implements Comparable<Edge> {
        private int id1, id2;
        private double dist;

        public Edge(int id1, int id2, double dist) {
            this.id1 = id1;
            this.id2 = id2;
            this.dist = dist;
        }

        @Override
        public int compareTo(Edge o) {
            return Double.compare(dist, o.dist);
        }
    }

    private static class Point {
        private int x, y, id;

        public Point(int id, int x, int y) {
            this.id = id;
            this.x = x;
            this.y = y;
        }
    }
}
